package com.nkzy.mapper;

//import com.nkzy.entity.Address;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface AddressService {

    @Select("SELECT * FROM address")
    List<AddressMapper> selectAllAddress();

    @Select("SELECT * FROM address WHERE id = #{id}")
    AddressMapper selectAddressById(Long id);

    @Insert("INSERT INTO address(address_line, city, state, zip_code) VALUES(#{addressLine}, #{city}, #{state}, #{zipCode})")
    @Options(useGeneratedKeys = true, keyProperty = "id")
    void insertAddress(AddressMapper address);

    @Update("UPDATE address SET address_line = #{addressLine}, city = #{city}, state = #{state}, zip_code = #{zipCode} WHERE id = #{id}")
    void updateAddress(AddressMapper address);

    @Delete("DELETE FROM address WHERE id = #{id}")
    void deleteAddressById(Long id);
}
